package demo3;

class Animal{
    protected String name;
    public Animal(String name){
        this.name = name;
    }
}

interface IFlying{
    void fly();
}
interface IRunning{
    void run();
}
interface ISwimming{
    void swim();
}

class Bird extends Animal implements IFlying{
    @Override
    public void fly(){
        System.out.println(this.name + "正在飞");
    }
    public Bird(String name){
        super(name);
    }
}

class Frog extends Animal implements IRunning,ISwimming{

    public Frog(String name){
        super(name);
    }

    @Override
    public void run(){
        System.out.println(this.name + "正在跑");
    }

    @Override
    public void swim(){
        System.out.println(this.name + "正在游泳");
    }
}
class Dark extends Animal implements IRunning,ISwimming,IFlying{
    public Dark(String name){
        super(name);
    }

    @Override
    public void run(){
        System.out.println(this.name + "正在跑");
    }

    @Override
    public void swim(){
        System.out.println(this.name + "正在游泳");
    }

    @Override
    public void fly() {
        System.out.println(this.name + "正在飞");
    }
}

class Roobot implements IRunning{
    @Override
    public void run(){
        System.out.println("机器人在跑");
    }
}

public class Test4 {
    public static void runFunc(IRunning irunning){
        irunning.run();
    }
    public static void swimmingFunc(ISwimming iswimming){
        iswimming.swim();
    }
    public static void flyingFunc(IFlying iflying){
        iflying.fly();
    }

    public static void main(String[] args) {
        flyingFunc(new Dark("鸭子"));
        flyingFunc(new Bird("小鸟"));
        runFunc(new Roobot());
    }
    public static void main1(String[] args) {
        runFunc(new Dark("鸭子"));
        runFunc(new Frog("青蛙"));

    }
}
